from functools import reduce

data = [1, 2, 3, 4]

# 1. filter：留下奇数
odd = list(filter(lambda x: x % 2, data))      # → [1, 3]

# 2. map：全部平方
squares = list(map(lambda x: x*x, data))       # → [1, 4, 9, 16]

# 3. reduce：求和
total = reduce(lambda a, b: a + b, data, 0)     # → 10

print(odd,squares,total)